package com.sumainfor.pc.epc.controller;

import com.sumainfor.common.util.FieldCheckUtil;
import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.PageUtils;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.epc.feign.Zfeign.ZpcMktFeign;
import com.sumainfor.pc.epc.feign.Zfeign.ZzuulFeign;
import com.sumainfor.pc.epc.service.AssistantWorkbenchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 工程助理（工作台）
 * <p>
 *
 * @author: zhoucong
 * @create: 2019-04-09 10:03
 **/
@Controller
@RequestMapping("/assistantWorkbench")
public class AssistantWorkbenchController {

    @Autowired
    AssistantWorkbenchService assistantWorkbenchService;

    @Autowired
    ZpcMktFeign zpcMktFeign;

    @Autowired
    ZzuulFeign zzuulFeign;
    /**
    * <p>
    * 重要状态提醒
    * </p>
    *
    * @author: zhoucong
    * @since:
    */
    @ResponseBody
    @GetMapping("/importantState")
    public JsonResult importantState(){
        return assistantWorkbenchService.importantState();
    }

    /**
    * <p>
    * 系统消息提醒
    * </p>
    *
    * @author: zhoucong
    * @since:
    */
    @ResponseBody
    @GetMapping("/systemMessage")
    public JsonResult systemMessage(@RequestParam Map<String,Object> params, Pager pager){
        System.out.println("asd"+params);
        JsonResult result = new JsonResult();
        if(!FieldCheckUtil.isMapFieldNotNull(params ,new String[]{"MeType"})){
            return  result.putFailed("消息角色不能为空...");
        }
        return zzuulFeign.getMessageList(params,pager);

    }

    /**
    * <p>
    * 待审核配置房源
    * </p>
    *
    * @author: zhoucong
    * @since:
    */
    @ResponseBody
    @GetMapping("/getHousingPlanList")
    public JsonResult getHousingPlanList(@RequestParam Map<String,Object> params,Pager pager) {
    return zpcMktFeign.getAuditHousing(params,pager);
    }
}
